#include<cstdio>
#include<iostream>
#define ull unsigned long long
using namespace std;
ull n=2,l=0,r=0,k6=0;
int main(){
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	cin>>n>>l>>r;
	k6=(l/n);
	if(n-1<(r-k6*n)) cout<<n-1;
	else cout<<(r-k6*n);
	return 0;
}
